/*
 * Created on Feb 11, 2009
 *
 * TODO
 */
package jacky.lanlan.song.extension.vraptor2;

import org.vraptor.VRaptorException;
import org.vraptor.component.ComponentType;
import org.vraptor.interceptor.InterceptorType;
import org.vraptor.plugin.VRaptorPlugin;
import org.vraptor.webapp.WebApplication;

/**
 * 启用该扩展功能的插件。
 * <p>
 * 使用方法:<br>
 * vraptor.xml里面添加 {@code
 * <plugin>jacky.lanlan.song.extension.vraptor2.InterceptorRegPlugin</plugin>}
 * ，然后在需要的类上标注{@code EnhanceInterceptor}
 * 
 * @author Jacky.Song
 */
public class InterceptorRegPlugin implements VRaptorPlugin {
	
	@Override
	public void init(WebApplication app) throws VRaptorException {
		for (ComponentType type : app.getComponentManager().getComponents()) {
			type.getInterceptors().add(InterceptorType.getType(EnhanceInterceptor.class));
		}
	}
	
}
